<template>
  <div v-bind:class="['button-module',{active:module.active}]">
    <v-svg :src="module.icon" width="24px" height="24px" :color="color"></v-svg>
    <span :style="{color:color}">{{ module.name }}</span>
    <div class="triangle"></div>
    <div class="layer"></div>
  </div>
</template>
<script>
import svg from './svg'
export default {
  name: 'module',
  props: {
    module: {
      type: Object
    }
  },
  computed: {
    color() {
      if (this.module.active) {
        return '#4475d9'
      } else {
        return '#ffffff'
      }
    }
  },
  components: {
    'v-svg': svg
  }

}
</script>
<style lang='less'>
@import '../assets/css/base.less';
.button-module{
    display: flex;
    flex-direction: column;
    justify-content: center;

    height: 75px;
    width: 70px;

    position: relative;

    >*{
        margin-left: auto;
        margin-right: auto;
    }

    span{
        font-size: 12px;

        margin-top: 10px;
    }
    
    .triangle{
        width: 0;
        height: 0;

        position: absolute;
        right: 0;
      }

    &.active{
      background: #fff;
      .triangle{
        border-top: 10px solid transparent;
        border-right: 10px solid #e9e9e9;
        border-bottom: 10px solid transparent;
      }
    }


    .layer{
      position: absolute;
      width: 100%;
      height: 100%;
    }
}
</style>
